package com.itheima;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        for (int i = 1; i <= 8; i++) {
            System.out.println("请录入第" + i + "个评委成绩");
            int score = sc.nextInt();
            list.add(score);
        }
        Integer max = list.get(0);
        Integer min = list.get(0);
        int sum = 0;
        for (Integer score : list) {
            if (score > max) {
                max = score;
            }
            if (score < min) {
                min = score;
            }
            sum += score;
        }

        double avg = (sum - max - min) * 1.0 / (list.size() - 2);
        System.out.println("平均成绩为:"+avg);
    }
}
